package com.eddie.mediator;

/**
 * @author Eddie
 * @date 2022/08/04 11:22
 **/
public class Client {
    public static void main(String[] args) {
        //创建一个中介者对象
        ConcreteMediator concreteMediator = new ConcreteMediator();
        //创建Alarm加入到concreteMediator 对象Hash
        Alarm alarm = new Alarm(concreteMediator, "alarm");
        //创建了CoffeeMachine对象，并加入到concreteMediator
        CoffeeMachine coffee = new CoffeeMachine(concreteMediator, "Coffee");
        //创建了窗帘并加入到ConcreteMediator，对象的HashMap
        Curtains curtains = new Curtains(concreteMediator, "Curtains");

        TV tv = new TV(concreteMediator, "TV");

        //让闹钟发出消息
        alarm.sendAlarm(0);
        coffee.sendCoffee(0);

    }
}
